<template>
	<view class="userAgreement">
		<u-navbar
			back-text="注销协议"
			:background="{
				background: '#ffffff'
			}"
		></u-navbar>
		<view class="title">{{ title }}</view>
		<view class="content_box"><towxml :nodes="article" /></view>
		<u-back-top :scroll-top="scrollTop" top="600"></u-back-top>
	</view>
</template>

<script>
import towxml from '@/static/towxml/towxml';
export default {
	name: 'userAgreement',
	components: {
		towxml
	},
	data() {
		return {
			scrollTop: 0,
			towxmlFunc: require('@/static/towxml/index.js'),
			title: '',
			article: ''
		};
	},
	//实例创建完成后被立即调用
	created() {},
	onLoad(option) {},
	//挂载开始之前被调用
	beforeMount() {},
	onPullDownRefresh() {
		//监听下拉刷新动作的执行方法，每次手动下拉刷新都会执行一次
		console.log('refresh');
		setTimeout(function() {
			uni.stopPullDownRefresh(); //停止下拉刷新动画
		}, 1000);
	},
	onPageScroll(obj) {
		// console.log(obj);
		this.scrollTop = obj.scrollTop;
	},
	//初次渲染完成
	onReady() {
		this.getAgreementInfo();
	},
	//全局只触发一次
	onLaunch() {},
	//从后台进入前台
	onShow() {},
	//前台进入后台
	onHide() {},
	methods: {
		getAgreementInfo() {
			this.$u.api
				.getAgreementInfo({
					status: '注销协议'
				})
				.then(res => {
					console.log(res);
					this.title = res.data.type;
					let result = this.towxmlFunc(res.data.content, 'markdown');
					this.article = result;
				})
				.catch(err => {
					console.log(err);
				});
		}
	}
};
</script>

<style lang="scss" scoped>
.userAgreement {
	.title {
		padding: 20rpx;
		margin: 0 auto;
		text-align: center;
		font-size: 36rpx;
		font-weight: 600;
		background-color: #ffffff;
	}
	.content_box {
		min-height: 80vh;
	}
}
</style>
